Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove uses of strtok() and other global state in svm_load_model(). #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tavianator
Copy link
Contributor

strtok() (as well as the internal readline() function) used global
state, and therefore were not thread-safe. Replace them with reentrant
equivalents. Thread-safety of loading was checked with valgrind's
helgrind and drd tools.

As an added bonus, the new tokenization functions are much faster than
strtok(). In a benchmark with a large model, overall loading time
decreased by 45% (1.1s vs 1.9s over 32 trials).

strtok() (as well as the internal readline() function) used global
state, and therefore were not thread-safe.  Replace them with reentrant
equivalents.  Thread-safety of loading was checked with valgrind's
helgrind and drd tools.

As an added bonus, the new tokenization functions are much faster than
strtok().  In a benchmark with a large model, overall loading time
decreased by 45% (1.1s vs 1.9s over 32 trials).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant