Skip to content

Instantly share code, notes, and snippets.

@mikeschinkel
Last active December 15, 2015 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeschinkel/de9abfa8a3456c6bbba2 to your computer and use it in GitHub Desktop.
Save mikeschinkel/de9abfa8a3456c6bbba2 to your computer and use it in GitHub Desktop.
PHP WordPress memory calculations
PHP, WordPress, Simple Class, Just Class, Post Types
====================================================
At first load
just_php= 625112 = 625112
just_php_mb = just_php / 1024^2 = 0.5961532593
After theme's functions.php file
wordpress = 21929808 = 21929808
wordpress_mb = wordpress/1024^2 = 20.9138946533
wordpress_only = wordpress - just_php = 21304696
wordpress_only_mb = wordpress_mb - just_php_mb = 20.317741394
A class and a handful of properties
after_class = 21936368 = 21936368
after_class_mb = after_class/1024^2 = 20.9201507568
class_with_properties = after_class - wordpress = 6560
class_with_properties_mb = after_class_mb - wordpress_mb = 0.0062561035
class_percent_wordpress = 1 - (wordpress_only - class_with_properties)/wordpress_only = 0.0003079133
class_as_percent_wordpress = class_percent_wordpress × 100 = 0.0307913335
wordpress_as_times_class = 1/class_percent_wordpress = 3247.6670731707
Just a class, no properties
after_just_class = 21941144 = 21941144
after_just_class_mb = after_just_class/1024^2 = 20.9247055054
just_class = after_just_class - after_class = 4776
just_class_mb = after_just_class_mb - after_class_mb = 0.0045547485
just_class_percent_wordpress = 1 - (wordpress_only - just_class)/wordpress_only = 0.0002241759
Before create_initial_post_types()
before_post_types = 20120160 = 20120160
before_post_types_mb = before_post_types/1024^2 = 19.188079834
After create_initial_post_types()
after_post_types = 20250392 = 20250392
after_post_types_mb = 20250392/1024^2 = 19.3122787476
After create_initial_post_types()
post_types = after_post_types - before_post_types = 130232
post_types_mb = after_post_types_mb - before_post_types_mb = 0.1241989136
class_as_percent_post_type = class_with_properties/post_types = 0.0503716444
post_type_as_times_class = 1/class_as_percent_post_type = 19.8524390244
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment