# WIP: faster string sort

**URL:** <https://discourse.julialang.org/t/wip-faster-string-sort/7671>\
**Category:** Internals & Design\
**Tags:** strings, sort\
**Created:** [December 10, 2017, 11:54am UTC](https://discourse.julialang.org/t/wip-faster-string-sort/7671 "2017-12-10T11:54:40Z")\
**Posts on this page:** 1\
**Showing post:** 47

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [December 28, 2017, 3:22pm UTC](https://discourse.julialang.org/t/wip-faster-string-sort/7671/47 "2017-12-28T15:22:28Z")

</div>

> [@xiaodai](#):
>
> discusses how R stores the strings and they do use some kind of “cache/look up” table for their strings; probably to save on RAM usage.

Two potential advantages are lower RAM usage, and very fast comparison because `strcmp` becomes a pointer comparison rather than character-by-character. The trade-off is that every string construction then requires a hash table look up.

The computer science name for this technique is [string interning](https://en.wikipedia.org/wiki/String_interning). Julia’s `Symbol` type is interned like that, and I believe I’ve seen posts about (ab)using it for general string interning – but I’m not sure if such a use-case is intended 😄.  
See also: [[ANN] InternedStrings.jl: Allocate strings once and reuse them](https://discourse.julialang.org/t/ann-internedstrings-jl-allocate-strings-once-and-reuse-them/7344)

---

_[View the full topic](https://discourse.julialang.org/t/wip-faster-string-sort/7671)._
