Open Bug 535623 Opened 15 years ago Updated 2 years ago

Improve hunspell's FileMgr implementation to reduce the I/O cost

Categories

(Core :: Spelling checker, defect)

defect

Tracking

()

People

(Reporter: ehsan.akhgari, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf, Whiteboard: [ts][Snappy:P3])

Attachments

(1 file)

Attached patch Initial patchSplinter Review
hunspell is really dumb in the way it reads files, it just fopen's the files and reads from them in a fgets loop.

This patch changes that behavior to read the entire file into a memory buffer and return line chunks to the callers from that buffer.  I tried to get smart and avoid strcpy as much as I could, so I'm returning lines from inside the buffer.

This can probably be further improved, but I'm curious how much improvement it could show in dtrace logs.  I'll try to see if things can be made such that this doesn't happen on startup path at all, though in another bug probably.
Blocks: 447581
Dietrich, could you get someone on the startup team to measure the number of reads for the hunspell dictionary files before and after this patch?  If there's an improvement here, I'd like to get this patch landed.
Whiteboard: [ts] → [ts][Snappy]
Whiteboard: [ts][Snappy] → [ts][Snappy:P3]
Assignee: ehsan → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.