Skip to content

Instantly share code, notes, and snippets.

@yadudoc
Created January 30, 2014 00:04
Show Gist options
  • Save yadudoc/8699928 to your computer and use it in GitHub Desktop.
Save yadudoc/8699928 to your computer and use it in GitHub Desktop.
Swift-Memory Analysis
Number of files, File size, no_strings.swift-Used_Heap, no_strings.swift-Crt_Heap, strings.swift-Used_Heap, strings.swift-Crt_Heap
1, 1, 93Mb, 362M, 95Mb, 362Mb
10, 1, 95Mb, 362M, 175Mb, 457Mb
100, 1, 95Mb, 362M, ---Mb, 362Mb
Experiment 2: Lazy ranges.
Assumptions: An int in swift, is 8 Bytes (64 bit). Array is a hashtable with unknown memory pattern.
10^6 integers should take ~8Mb.
Use java.lang.Math.abs(int)
Swift 0.94, with 256Mb heap fails with java.lang.OutOfMemoryError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment