keiosweb / moneyright

Arbitrary precision arithmetic-based Money value object following GAAP rounding principles
MIT License
20 stars 4 forks source link

JSON performance #2

Closed fatganz closed 9 years ago

fatganz commented 9 years ago

Using JSON as currency data storage degrades library performance. I specifically have in mind web case when OP code accelerator is used. For me it gives ~10% speed decrease because JSON should be re-read every time when web request is happening.

keiosweb commented 9 years ago

Would move towards plain PHP array in separate file required only once to hydrate Currency data field help with performance?

fatganz commented 9 years ago

Yes, once PHP file is cached by PHP accelerator it won't read it form filesystem until it's changed.

keiosweb commented 9 years ago

Is this what you wanted?

https://github.com/keiosweb/moneyright/commit/3497132fd0a65346b9a509099b7fdd893558448d

keiosweb commented 9 years ago

Tests pass, merged to master, released https://github.com/keiosweb/moneyright/releases/tag/v1.0.5

fatganz commented 9 years ago

Yes, exactly. Good job :+1:

keiosweb commented 9 years ago

:+1: