草庐IT

pre-allocation

全部标签

GopherCon SG 2019 "Understanding Allocations" 学习笔记

本篇是根据GopherConSG2019“UnderstandingAllocations”演讲的学习笔记。UnderstandingAllocations:theStackandtheHeap-GopherConSG2019-YouTube理解分配:栈和堆你的程序中有两种内存,栈内存和堆内存。go中,每个go程都会有一个栈空间,整个程序有一个堆空间。变量是在栈还是堆上负责堆垃圾回收的GC会导致整个程序的延迟,而不仅仅是创建垃圾的部分。你可能会担心你的代码在堆中产生了多少垃圾。什么时候需要优化要有benchmarks基准来证明你的程序不够快(有大量的堆内存分配),够快就不用多此一举了。你要先确

iOS 启动优化(一) pre-main

如何精确度量iOSApp的启动时间iOS启动分为两个时间:pre-main时间main时间一、pre-main时间检测Xcode提供了一个很赞的方法,只需要在Editscheme->Run->Arguments中将环境变量DYLD_PRINT_STATISTICS设为1,就可以看到main之前各个阶段的时间消耗Totalpre-maintime:341.32milliseconds(100.0%)dylibloadingtime:154.88milliseconds(45.3%)rebase/bindingtime:37.20milliseconds(10.8%)ObjCsetuptime:5

iOS 启动优化(一) pre-main

如何精确度量iOSApp的启动时间iOS启动分为两个时间:pre-main时间main时间一、pre-main时间检测Xcode提供了一个很赞的方法,只需要在Editscheme->Run->Arguments中将环境变量DYLD_PRINT_STATISTICS设为1,就可以看到main之前各个阶段的时间消耗Totalpre-maintime:341.32milliseconds(100.0%)dylibloadingtime:154.88milliseconds(45.3%)rebase/bindingtime:37.20milliseconds(10.8%)ObjCsetuptime:5

iOS-OC底层一:对象alloc的本质

1.准备源码程序源码分析alloc&init&new的流程,使用从github上下载的LGCooci的源码https://github.com/LGCooci/KCCbjc4_debug。因为设备限制,我是基于818的源码进行学习。从github下载完成后,在KCObjcBuild所在的目录新建一个OC类命名为Person,Person类中什么都不写。在main.m中写入如下代码:#import"Person.h"Person*p1=[Personalloc];Person*p2=[p1init];Person*p3=[p1init];NSLog(@"%@-%p-%p",p1,p1,&p1);

iOS-OC底层一:对象alloc的本质

1.准备源码程序源码分析alloc&init&new的流程,使用从github上下载的LGCooci的源码https://github.com/LGCooci/KCCbjc4_debug。因为设备限制,我是基于818的源码进行学习。从github下载完成后,在KCObjcBuild所在的目录新建一个OC类命名为Person,Person类中什么都不写。在main.m中写入如下代码:#import"Person.h"Person*p1=[Personalloc];Person*p2=[p1init];Person*p3=[p1init];NSLog(@"%@-%p-%p",p1,p1,&p1);

关于 c :Class locals as predicates pre C 11

ClasslocalsaspredicatespreC++11以下代码在使用GCC和Clang在C11模式下编译时不会出现错误/警告。但是,如果我尝试在没有C11模式的情况下进行编译,并且在第二个范围内发生错误。#include#includestructastruct{  intv;};structastruct_cmp0{  booloperator()(constastruct&a0,constastruct&a1){   returna0.va1.v;  }};intmain(){  std::vectoralist;  {   //Works-noerrors   std::stab

关于 c :Class locals as predicates pre C 11

ClasslocalsaspredicatespreC++11以下代码在使用GCC和Clang在C11模式下编译时不会出现错误/警告。但是,如果我尝试在没有C11模式的情况下进行编译,并且在第二个范围内发生错误。#include#includestructastruct{  intv;};structastruct_cmp0{  booloperator()(constastruct&a0,constastruct&a1){   returna0.va1.v;  }};intmain(){  std::vectoralist;  {   //Works-noerrors   std::stab