Skip to content

TenaciousQuokka/String-Builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String-Builder

An experiment in time complexity versus real world performance

Results

Sample Output:

Runtime of join_words_cat was 5.8871 seconds
Runtime of join_words_builder was 29.0302 seconds
Runtime of join_words_join was 0.5058 seconds

Concatenation-based string building is known to be inefficient in some cases. In the real world, concatenation seems to work just fine for small scale string building. In this example, the additional overhead of a custom string building class far outweighs the benefits of its reduced time complexity. Python's str.join() method is shown to be the simplest and most efficient option, boosted by its efficient algorithm and C implementation.

About

Experimenting with string building performance

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages