After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 64433 - Unicode tables could be improved
Unicode tables could be improved
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Andrew Taylor
Andrew Taylor
Depends on:
Blocks:
 
 
Reported: 2001-11-13 02:13 UTC by Andrew Taylor
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed fix. (9.59 KB, patch)
2001-11-13 02:14 UTC, Andrew Taylor
none Details | Review

Description Andrew Taylor 2001-11-13 02:13:11 UTC
The tables for storing Unicode attributes in gunichartables.h, gunicomp.h,
gunidecomp.h, and gunibreak.h could be improved.

In particular, the tables are implemented as an array of pointers into
other arrays.  This causes the linker to insert many unnecessary
relocations and forces the pointer arrays into the .data section instead of
the .rodata section of an ELF executable.  Given that glib is shared among
many programs, getting as much data as possible in the .rodata section is
important.

Additionally, the footprint could be reduced by storing indices as shorts
rather than pointers.

Finally, it should be noted that all the relevent header files are
automatically generated from the Unicode spec files by
gen-unicode-tables.pl, a perl script.
Comment 1 Andrew Taylor 2001-11-13 02:14:50 UTC
Created attachment 6012 [details] [review]
Proposed fix.
Comment 2 Andrew Taylor 2001-11-13 02:22:54 UTC
Here is a patch that fixes this bug.  It implements the pages of
Unicode tables as a two-dimensional array, and replaces the array of
pointers with an array of indices (as shorts).

The behavior of all functions that depend on these tables is unchanged.

The footprint savings are summarized here:

       | .rodata  .data  relocs
-------+-----------------------
before | 117,415  34,692  4109
after  | 119,975  29,508  3955
-------+-----------------------
          +2,560  -5,184  -154

In other words, about 2.5k is saved, another 2.5k is moved from .data
to .rodata, and 154 relocations are saved.  The .rodata and .data
sizes were measured with objdump -h, the relocations with objdump -R.
Comment 3 Owen Taylor 2001-11-14 02:33:07 UTC
Tue Nov 13 21:25:35 2001  Owen Taylor  <otaylor@redhat.com>

	* glib/{gen-unicode-tables.pl,gunibreak.c,gunibreak.h,
	gunichartables.h, gunicomp.h, gunidecomp.[ch], 
	guniprop.c}: Patch from Andrew Taylor to improve
	tables and reduce relocations by using indices 
	rather than pointers. (#64433)
	
	* tests/unicode-normalize.c (main): Fix for changes
	to g_strsplit().