Open Bug 1275280 Opened 8 years ago Updated 2 years ago

consider converting to one-byte strings in dom bindings

Categories

(Core :: DOM: Core & HTML, defect, P3)

48 Branch
defect

Tracking

()

People

(Reporter: bkelly, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [MemShrink:P2] btpp-backlog)

I recently noticed that both twitter and IRC cloud end up with a number of fairly large strings over time.  These appear to be the result of XHR or other gecko "external" strings.

The js engine has the ability to work with single byte strings when the data allows, but all external gecko strings end up as two-byte strings.  We should consider scanning string values and converting them automatically before exposing them to script.
Whiteboard: [MemShrink]
Actually, the large strings in irccloud's case are scripts.  So maybe we should try making script loader convert strings to one-byte if possible.
Whiteboard: [MemShrink] → [MemShrink] btpp-backlog
Single byte strings would be great, particularly for base64 encoded data which is all ascii but ends up taking up 2X the amount of memory it needs to (think data URIs).

(In reply to Ben Kelly [:bkelly] from comment #1)
> Actually, the large strings in irccloud's case are scripts.  So maybe we
> should try making script loader convert strings to one-byte if possible.

Perhaps file a separate bug for this? I'm going to check with the JS folks to see what were currently do. I know that at some point we compress the scripts, but I'm not sure what the heuristic is on that.
FWIW, nsTextFragment (the object which is used for text data in TextNodes) can store 8bit (not utf8!) and 16bit strings. Perhaps we should somehow generalize that. Detecting whether 16bit storage is needed can be a bit slow, so there is special SSE2 optimization in nsTextFragmentSSE2.cpp
Whiteboard: [MemShrink] btpp-backlog → [MemShrink:P2] btpp-backlog
Priority: -- → P3
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.