Last change
on this file since 59381 was 58016, checked in by vboxsync, 9 years ago |
USBIdDatabase*: Size optimization reducing VBoxSVC by xxxx bytes on 64-bit Windows (debug) - just for the fun of it. :-)
- Use parallel arrays instead of structures/classes with alignment padding (4 or 6 bytes on 64-bit hosts).
- Exchanging the vendor id in the product table for a product table index and length in the vendor entry.
- Use a string table with 32-bit references that includes the size.
- The 32-bit references saves relocations.
- The string table skips the terminator char, saving 1 byte per string.
- The string table eliminates duplicate strings and duplicate substrings.
- Very simple compression that replaces the 127 most frequently used words.
- Replaced lower_bound with handcoded binary lookup (easier for parallel arrays, seems to reduce code size too).
Before:
VBoxSVC.exe w/ db: 10145792 bytes,
VBoxSVC.exe w/o db: 9436672 bytes,
Database cost: 709120 bytes.
After:
VBoxSVC.exe w/ db: 9797120 bytes
VBoxSVC.exe w/o db: 9439232 bytes
Database cost: 357888 bytes
Saving 351232 bytes (49%).
PS. Relocations saving estimated to be around 30987 bytes (a bit uncertain because of string pooling by the compiler / linker).
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.2 KB
|
Line | |
---|
1 | /* $Id: USBIdDatabaseStub.cpp 58016 2015-10-03 18:47:11Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * USB device vendor and product ID database - stub.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2015 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include "USBIdDatabase.h"
|
---|
19 |
|
---|
20 | const char USBIdDatabase::s_achStrTab[] = "";
|
---|
21 | const size_t USBIdDatabase::s_cchStrTab = 0;
|
---|
22 | #ifdef USB_ID_DATABASE_WITH_COMPRESSION
|
---|
23 | const USBIDDBSTR USBIdDatabase::s_aCompDict[127];
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | const size_t USBIdDatabase::s_cVendors = 0;
|
---|
27 | const USBIDDBVENDOR USBIdDatabase::s_aVendors[] = { 0 };
|
---|
28 | const USBIDDBSTR USBIdDatabase::s_aVendorNames[] = { {0,0} };
|
---|
29 |
|
---|
30 | const size_t USBIdDatabase::s_cProducts = 0;
|
---|
31 | const USBIDDBPROD USBIdDatabase::s_aProducts[] = { 0 };
|
---|
32 | const USBIDDBSTR USBIdDatabase::s_aProductNames[] = { {0,0} };
|
---|
33 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.