Skip to content

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.

1 participant