On 8/22/2024 9:36 PM, Lawrence D'Oliveiro wrote:
On Thu, 22 Aug 2024 15:59:34 -0500, BGB wrote:
Underused: It is a sensible way of structuring data, but needing to
interface with it though SQL strings is awkward and inefficient.
Actually, that works fine in any language with decent string handling.
String processing adds bulk and inefficiency.
Granted, maybe not enough to matter in the face of a typical database query.
But, I was left thinking, some programs use SQLite, which exists as a single giant C file. I guess it technically works, but has the downside of adding something like IIRC around 900K or so to the size of the binaries' ".text" section.
In my recent projects, I am left being a little more aware of how much code footprint and space everything costs (along with the limitations of trying to keep things performing acceptably at 50 MHz).
But, say, a goal would be to try to fit a semi-usable database engine into say a few kLOC or so (rather than several hundred kLOC).
Things like text parsing and other complex high level features would be on a high priority list of things to jettison.
Some can maybe still be present in the code, but:
If they are API calls, then if they are never called, code reachability can cull them;
If there is a text parser, and they are reachable from said parser, and the program uses said parser, one is SOL, code reachability will need to include the whole thing...
I guess, similar reasons for why one doesn't want to add too many complex string formatting features to "printf()" (since, if they are not used, they uselessly add bulk to any program that uses "printf()" and similar).
Similar related reasons for why TKGDI's built in image loading doesn't support JPG or PNG. Granted, OTOH, QOI is a bit niche, but decodes quickly and doesn't need all that much code (vs a PNG decoder).
Similar reasons for why I am still going with BMP for stuff, and am making use of CRAM (including in non-standard CRAM BMP images). Like, as much as CRAM "kinda sucks", it is fast and needs relatively little code for a decoder.
I still lack a good "cheap" JPEG stand-in. I had defined LCIF, which was essentially "QOI but with some color-cell stuff glued on". OK, but still not an ideal JPEG stand-in (one might want something that can be lossless or near lossless; LCIF's "top end" quality still basically looks like DXT1).
Then LCIF was left in competition with the "cheaper" option of CRAM+RP2 (where, if I already have a CRAM decoder and an RP2 decoder, RP2 encoded CRAM in a BMP doesn't add too much additional code footprint). Though, both top-end quality and Q/bpp are worse with CRAM.
Basic CRAM is ~ 2.0bpp, but with RP2 compression may be ~ 0.25 to 2.0 bpp depending on how LZ compressible the image is (and RP2 tends to beat LZ4 in this case). Works OK for UI graphics.
I have some ideas I could try, if I wanted to do something vaguely JPEG like but at a lower line count. But, in any case, if it goes too much over ~ 1k lines, it becomes moot (at around 2k lines, that is the size of a JPEG decoder).
Though, minimizing line-count would likely mean the "semi-crappy" option of probably using Rice coding and a block Haar transform.
Using 12-bit length limited Huffman would give better compression, but (unlike Rice) would still need around 250 lines for the entropy coder (vs ~ 100 or so for Rice, mostly due to bitstream code, like PeekBits/SkipBits/ReadBits functions).
Well, and my kernel has already gotten fairly large, due to the existing overhead needed for GUI and GL backend stuff (it becomes tempting to try to fold this off into a DLL).
Or, do some weird OO thing where object methods exist for SQL keywords
and each method returns an object that can be used to glue on the next
keyword:
res=db.select().from("FOOTAB").where().equals("NAME", "John").end();
ORMs are a waste of time.
Yeah, this is not an API design of honor...
Granted, trying to awkwardly map it to an OpenGL style API design wouldn't be much better, say:
dbmsBeginSelect();
dbmsFromTable("FOOTAB");
dbmsWhere(DBMS_EQUAL, "NAME", "John");
dbmsEndSelect();
while(dbmsPollResult())
{
dbmsGetResultStr("NAME", dbFirstName);
dbmsGetResultStr("LAST", dbLastName);
...
dbmsNextResult();
}
One other possibility might be something like, say:
DBMS_HTABLE hFootab;
DBMS_HKEYELEM aSelKey[8];
DBMS_HVALELEM aSelVal[8];
DBMS_HENUM aSelOpr[8];
DBMS_HKEYELEM aResKey[12];
DBMS_HVALELEM aResVal[12];
FBMS_HQUERY hRes;
int nResCol;
int i, j, k;
aSelKey[0]=dbmsGetHKey(db, "NAME");
aSelVal[0]=dbmsGetHString(db, "John");
aSelOpr[0]=DBMS_EQUAL;
hFooTab=dbmsOpenTable(db, "FOOTAB");
hRes=dbmsTableSelect(db,
hFooTab, aSelKey, aSelOpr, aSelVal, 1, NULL, 0);
nResCol=12; //max of 12 columns
dbmsGetResultRowKeys(db, hRes, aResKey, &nResCol);
for(i=0; i<nResCol; i++)
{
str=dbGetKeyName(db, aResKey[i]);
printf("%s ". str);
}
printf("\n");
while(dbmsPollResultNotDone(db, hRes))
{
dbmsReadResults(db, hRes, aResKey, aResVal, nResCol);
// do something with results
for(i=0; i<nResCol; i++)
{
str=dbGetValueAsStringTemp(db, aResVal[i]); //*1
printf("%s ". str);
}
printf("\n");
}
dbmsCloseResults(db, hRes);
*1: Where the string pointer will be valid until either the next results are read or the results are closed. Similarly, any values read from the results will only be valid until either the next results are read or the results are closed.
Such an API design would still be awkward, but could potentially be lower overhead than some other options.
Skimming SQLite DB format:
Why such large nodes?...
I would have thought maybe 4K, not 32K or 64K...
Then again, maybe bigger might be better for less row-related fragmentation.
Big Endian for some reason.
It is a bit more variable-length than I had imagined.
My guess would have been to have a 4-bit tag, say:
0: Int32
1: Float32
2: Int64
3: Float64
4: String, 0..8 B (Inline)
5: String, 9..16 B (Inline)
6: String/Blob, Stored at end of node
7, String/Blob, Stored elsewhere
...
Maybe a case could be made for including Int16 and Binary16.
The Null value need not be present, since any absent column would be assumed Null.
Likely end-of-node would be a 32-bit format, say:
(31:30): String or Blob
(29:18): Size
(17: 0): Offset
The "Elsewhere" format would be 64-bit, also encoding the Node for where to look for the data:
0/1: String/Blob, Direct position within node.
2/3: Big String/Blob, (29:0) giving total size.
(63:32): Destination Node
Looks like SQLite relies on the table-layout to identify the columns, rather than what I had assumed of encoding a key's name ID with each item (and more built-in tables to describe the contents of the user-defined tables).
But, in a high-level sense, it seems that it isn't that far removed from what I had imagined either.
...
Skim: I had not considered the possibility of supporting journals or rollback. Seems like a needless expense for a "light duty" database.
Date | Sujet | # | | Auteur |
14 Aug 24 | Article on new mainframe use | 132 | | Stephen Fuld |
14 Aug 24 | Re: Article on new mainframe use | 124 | | MitchAlsup1 |
15 Aug 24 | Re: Article on new mainframe use | 123 | | George Neuner |
15 Aug 24 | Re: Article on new mainframe use | 1 | | Stephen Fuld |
15 Aug 24 | Re: Article on new mainframe use | 121 | | MitchAlsup1 |
15 Aug 24 | Re: Article on new mainframe use | 1 | | Stephen Fuld |
15 Aug 24 | Re: Article on new mainframe use | 118 | | Niklas Holsti |
16 Aug 24 | Re: Article on new mainframe use | 117 | | Lawrence D'Oliveiro |
16 Aug 24 | Re: COBOL, Article on new mainframe use | 30 | | John Levine |
17 Aug 24 | Re: COBOL, Article on new mainframe use | 5 | | Lawrence D'Oliveiro |
17 Aug 24 | Re: COBOL, Article on new mainframe use | 1 | | John Levine |
17 Aug 24 | Re: COBOL, Article on new mainframe use | 3 | | Keith Thompson |
18 Aug 24 | Re: coroutines in COBOL, Article on new mainframe use | 2 | | John Levine |
18 Aug 24 | Re: coroutines in COBOL, Article on new mainframe use | 1 | | Lawrence D'Oliveiro |
18 Aug 24 | Re: COBOL, Article on new mainframe use | 24 | | OrangeFish |
18 Aug 24 | Re: COBOL, Article on new mainframe use | 1 | | John Levine |
18 Aug 24 | Re: COBOL, Article on new mainframe use | 22 | | John Dallman |
18 Aug 24 | Re: COBOL, Article on new mainframe use | 14 | | MitchAlsup1 |
19 Aug 24 | Re: COBOL, Article on new mainframe use | 1 | | John Dallman |
23 Aug 24 | Re: COBOL, Article on new mainframe use | 12 | | Terje Mathisen |
23 Aug 24 | Re: COBOL, Article on new mainframe use | 11 | | Michael S |
23 Aug 24 | Re: COBOL, Article on new mainframe use | 10 | | Terje Mathisen |
23 Aug 24 | Re: COBOL, Article on new mainframe use | 9 | | Michael S |
23 Aug 24 | Re: COBOL, Article on new mainframe use | 6 | | John Levine |
24 Aug 24 | Re: COBOL, Article on new mainframe use | 1 | | Lawrence D'Oliveiro |
27 Aug 24 | Re: COBOL, Article on new mainframe use | 4 | | Keith Thompson |
28 Aug 24 | Re: COBOL, Article on new mainframe use | 3 | | MitchAlsup1 |
28 Aug 24 | Re: COBOL, Article on new mainframe use | 2 | | Keith Thompson |
2 Sep 24 | Re: COBOL, Article on new mainframe use | 1 | | Lawrence D'Oliveiro |
24 Aug 24 | Re: COBOL, Article on new mainframe use | 2 | | John Dallman |
28 Aug 24 | Re: COBOL, Article on new mainframe use | 1 | | Lawrence D'Oliveiro |
19 Aug 24 | Re: COBOL, Article on new mainframe use | 7 | | Lawrence D'Oliveiro |
19 Aug 24 | Re: COBOL, Article on new mainframe use | 6 | | John Levine |
21 Aug 24 | Re: COBOL, Article on new mainframe use | 5 | | Lawrence D'Oliveiro |
21 Aug 24 | Re: COBOL, Article on new mainframe use | 4 | | Keith Thompson |
21 Aug 24 | Re: COBOL, Article on new mainframe use | 3 | | MitchAlsup1 |
21 Aug 24 | Re: COBOL, Article on new mainframe use | 1 | | Keith Thompson |
2 Sep 24 | Re: COBOL, Article on new mainframe use | 1 | | Tim Rentsch |
16 Aug 24 | Re: Article on new mainframe use | 82 | | George Neuner |
22 Aug 24 | Re: Article on new mainframe use | 81 | | BGB |
23 Aug 24 | Re: Article on new mainframe use | 1 | | Stephen Fuld |
23 Aug 24 | Re: Article on new mainframe use | 79 | | Lawrence D'Oliveiro |
23 Aug 24 | Re: Article on new mainframe use | 77 | | BGB |
23 Aug 24 | Re: libraries, was Article on new mainframe use | 1 | | John Levine |
24 Aug 24 | Re: Article on new mainframe use | 75 | | Lawrence D'Oliveiro |
24 Aug 24 | Re: Article on new mainframe use | 1 | | BGB |
24 Aug 24 | Re: Article on new mainframe use | 73 | | John Levine |
28 Aug 24 | Re: Article on new mainframe use | 70 | | Lawrence D'Oliveiro |
29 Aug 24 | Re: Article on new mainframe use | 69 | | John Levine |
30 Aug 24 | Re: Article on new mainframe use | 68 | | Lawrence D'Oliveiro |
30 Aug 24 | Re: Article on new mainframe use | 67 | | Michael S |
30 Aug 24 | Re: Article on new mainframe use | 12 | | John Levine |
30 Aug 24 | Re: tiny COBOL, Article on new mainframe use | 11 | | John Levine |
31 Aug 24 | Re: tiny COBOL, Article on new mainframe use | 8 | | Stefan Monnier |
31 Aug 24 | Re: tiny COBOL, Article on new mainframe use | 5 | | Thomas Koenig |
2 Sep 24 | Re: tiny COBOL, Article on new mainframe use | 4 | | Terje Mathisen |
2 Sep 24 | Re: tiny COBOL, Article on new mainframe use | 2 | | Thomas Koenig |
2 Sep 24 | Re: tiny COBOL, Article on new mainframe use | 1 | | Anssi Saari |
2 Sep 24 | Re: tiny COBOL, Article on new mainframe use | 1 | | Anton Ertl |
31 Aug 24 | Re: tiny COBOL, Article on new mainframe use | 1 | | Anton Ertl |
31 Aug 24 | Re: tiny COBOL, Article on new mainframe use | 1 | | George Neuner |
2 Sep 24 | Re: tiny COBOL, Article on new mainframe use | 2 | | Lawrence D'Oliveiro |
4 Sep 24 | Re: tiny COBOL, Article on new mainframe use | 1 | | Lawrence D'Oliveiro |
1 Sep 24 | Re: Article on new mainframe use | 6 | | Lawrence D'Oliveiro |
1 Sep 24 | Re: COBOL history, Article on new mainframe use | 3 | | John Levine |
1 Sep 24 | Re: COBOL history, Article on new mainframe use | 1 | | Lynn Wheeler |
2 Sep 24 | Re: COBOL history, Article on new mainframe use | 1 | | Lawrence D'Oliveiro |
1 Sep 24 | Re: Article on new mainframe use | 2 | | John Dallman |
2 Sep 24 | Re: Article on new mainframe use | 1 | | Lawrence D'Oliveiro |
1 Sep 24 | Re: Article on new mainframe use | 48 | | Lawrence D'Oliveiro |
1 Sep 24 | Re: Article on new mainframe use | 47 | | MitchAlsup1 |
2 Sep 24 | Re: Article on new mainframe use | 46 | | Lawrence D'Oliveiro |
2 Sep 24 | Re: Address bits again, Article on new mainframe use | 45 | | John Levine |
2 Sep 24 | Re: Address bits again, Article on new mainframe use | 1 | | Thomas Koenig |
2 Sep 24 | Re: Address bits again, Article on new mainframe use | 1 | | Stephen Fuld |
4 Sep 24 | Re: Address bits again, Article on new mainframe use | 42 | | Lawrence D'Oliveiro |
4 Sep 24 | Re: Address bits again, Article on new mainframe use | 2 | | Terje Mathisen |
4 Sep 24 | Re: Address bits again, Article on new mainframe use | 1 | | Lawrence D'Oliveiro |
4 Sep 24 | Re: Address bits again, Article on new mainframe use | 39 | | John Levine |
4 Sep 24 | Re: Address bits again, Article on new mainframe use | 37 | | John Dallman |
4 Sep 24 | Re: Address bits again, Article on new mainframe use | 1 | | MitchAlsup1 |
5 Sep 24 | transparent huge pages (was: Address bits again) | 4 | | Anton Ertl |
5 Sep 24 | Re: transparent huge pages | 1 | | MitchAlsup1 |
5 Sep 24 | Re: transparent huge pages | 1 | | Chris M. Thomasson |
8 Sep 24 | Re: transparent huge pages (was: Address bits again) | 1 | | Lawrence D'Oliveiro |
5 Sep 24 | Re: Address bits again, Article on new mainframe use | 31 | | John Levine |
8 Sep 24 | Re: Address bits again, Article on new mainframe use | 30 | | Lawrence D'Oliveiro |
8 Sep 24 | Re: Address bits again, Article on new mainframe use | 29 | | MitchAlsup1 |
8 Sep 24 | Re: Address bits again, Article on new mainframe use | 4 | | MitchAlsup1 |
8 Sep 24 | Re: Address bits again, Article on new mainframe use | 3 | | Chris M. Thomasson |
9 Sep 24 | Re: Address bits again, Article on new mainframe use | 2 | | Lawrence D'Oliveiro |
9 Sep 24 | Re: Address bits again, Article on new mainframe use | 1 | | Chris M. Thomasson |
9 Sep 24 | Re: Address bits again, Article on new mainframe use | 24 | | Lawrence D'Oliveiro |
9 Sep 24 | Re: Address bits again, Article on new mainframe use | 23 | | MitchAlsup1 |
10 Sep 24 | Re: Address bits again, Article on new mainframe use | 22 | | Lawrence D'Oliveiro |
11 Sep 24 | Re: Address bits again, Article on new mainframe use | 2 | | John Levine |
11 Sep 24 | Re: Address bits again, Article on new mainframe use | 1 | | Lawrence D'Oliveiro |
11 Sep 24 | Re: Address bits again, Article on new mainframe use | 19 | | MitchAlsup1 |
12 Sep 24 | Re: Address bits again, Article on new mainframe use | 18 | | Lawrence D'Oliveiro |
12 Sep 24 | Re: Address bits again, Article on new mainframe use | 17 | | Lars Poulsen |
12 Sep 24 | Re: Address bits again, Article on new mainframe use | 13 | | Lawrence D'Oliveiro |
13 Sep 24 | Re: Address bits again, Article on new mainframe use | 3 | | George Neuner |
4 Sep 24 | Re: Address bits again, Article on new mainframe use | 1 | | Lawrence D'Oliveiro |
28 Aug 24 | Re: Article on new mainframe use | 2 | | Lawrence D'Oliveiro |
23 Aug 24 | Re: Article on new mainframe use | 1 | | George Neuner |
16 Aug 24 | Re: Article on new mainframe use | 4 | | Lynn Wheeler |
15 Aug 24 | Re: Article on new mainframe use | 1 | | Thomas Koenig |
15 Aug 24 | Re: Article on new mainframe use | 7 | | Lawrence D'Oliveiro |