Use autodie::exception directly #25

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

schwern commented Mar 24, 2013

I decided to see how much code it would be to use autodie::exception directly and what the performance gains were. There's not a lot of code, it could be improved, but the gains are considerable.

Load time drops from 100ms to 60ms.
Test suite runtime drops from 1650ms to 1250ms.

It gets better when combined with the startup diet.

Load time reduced from 100ms to 30ms vs master
Test runtime reduced from 1650ms to 1050ms vs master

That's a 70% improvement in load time and a 35% improvement in test runtime.

schwern added some commits Mar 24, 2013

Use autodie::exception directly.
Load time drops from 100ms to 60ms.
Test suite runtime drops from 1650ms to 1250ms.

The amount of code is not too bad at all.

Also...
* Using SEEK_SET rather than a hard coded constant
* lstat and stat now properly throw exceptions
@ghost
Collaborator

ghost commented Mar 24, 2013

Interesting! What about dropping autodie::exceptions?
On Mar 24, 2013 4:45 AM, "Michael G. Schwern" notifications@github.com
wrote:

I decided to see how much code it would be to use autodie::exception
directly and what the performance gains were. There's not a lot of code, it
could be improved, but the gains are considerable.

Load time drops from 100ms to 60ms.
Test suite runtime drops from 1650ms to 1250ms.

It gets better when combined with the startup diet.

Load time reduced from 100ms to 30ms vs master
Test runtime reduced from 1650ms to 1050ms vs master

That's a 70% improvement in load time and a 35% improvement in test

runtime.

You can merge this Pull Request by running

git pull https://github.com/schwern/path-tiny no_autodie

Or view, comment on, or merge it at:

dagolden#25
Commit Summary

  • Use autodie::exception directly.
  • Test that stat and lstat throw exceptions.

File Changes

  • M lib/Path/Tiny.pmhttps://github.com/dagolden/path-tiny/pull/25/files#diff-0(218)
  • M t/filesystem.thttps://github.com/dagolden/path-tiny/pull/25/files#diff-1(8)

Patch Links:

Contributor

schwern commented Mar 24, 2013

No noticeable effect on compile time. Runtime is obviously only affected if you have lots of exceptions which I'm not too worried about.

autodie::exception has value in being inspectable exception objects, for example you can extract the errno value directly, and it ensures the formatting is consistent.

@ghost
Collaborator

ghost commented Mar 26, 2013

refactored and applied to master

@ghost ghost closed this Mar 26, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment