-DONE Try to improve 'sameStr' by maybe not having to check s2[i2]
-When developed more, check if its better to us "strInTags" or "BM" for applicable uses
-Measure performance with
- struct timespec t0, t1;
- if(timespec_get(&t0, TIME_UTC) != TIME_UTC) {
- printf("Error in calling timespec_get\n");
- exit(EXIT_FAILURE);
- }
-
- //measure these two
- int a = strInTags(str, l, "percent", 7, ';');
- int a = BM("percent", 7, str, l);
-
- if(timespec_get(&t1, TIME_UTC) != TIME_UTC) {
- printf("Error in calling timespec_get\n");
- exit(EXIT_FAILURE);
- }
- // Calculate the elapsed time
- double diff = (double)(t1.tv_sec - t0.tv_sec) + ((double)(t1.tv_nsec - t0.tv_nsec)/1000000000L);
- printf("Elapsed time: %lf seconds\n", diff);
+Try different hashing functions (current: crc64), e.g murmur
+Change DB model from struct row
+ typedef struct{
+ char path[MAXPATH];
+ char tags[MAXTAGS];
+ uint16_t lenTags;
+ uint16_t numTags;
+ } row;
+to tables of ids
+ images[] tags[] images:tags[]
- DONE Try to improve 'sameStr' by maybe not having to check s2[i2]
++DONE Try to improve 'sameStr' by maybe not having to check s2[i2]
#include <time.h>
- void nothing(FILE *fp){
- uint64_t a = 0xDEADBEEF;
- fwrite(&a, sizeof(uint64_t), 1, fp);
- }
-
-
- void print(FILE *fp){
- while(!feof(fp)){
- uint8_t a;
- fread(&a, sizeof(uint8_t), 1, fp);
- printf("%x ", a);
- }
- }
-
int main(){
-
-
-
+ printf("%016llu\n", (uint64_t) crc64(0, (unsigned char*)"cacadevaca", 10));
+
inputBuffer *in = newInputBuffer();
-
+
+ char *str = "grandmother;football;capital;concerned;entire;realize;garden;refused;proud;tune;rhyme;other;writer;command;fresh;fence;rapidly;active;cover;repeat;determine;yard;cannot;animal;pure;rich;mirror;frozen;vast;coach;brass;activity;bottom;airplane;local;tone;attack;though;between;value;collect;mission;tower;brought;original;history;reason;minute;would;hung;strange;children;offer;blue;wrapped;magnet;color;cage;easily;percent;lower;verb;hundred;larger;away;was;certain;western;yes;lack;wish;same;spend;arrive;fog;heard;bill;effort;steam;wolf;indicate;suppose;because;life;down;seat;age;earn;under;cell;floating;although;spent;folks;swing;hello;cent;swung;pen;happened;slip;pupil;smell;fix;piano;closer;idea;trunk;model;school;particularly;he;coast;describe;such;join;been;hard;three;around;tube;soldier;baby;mouse;note;sort;house;gasoline;organized;eat;sat;crowd;alive;spoken;wide;square;luck;tales;angry;having;wear;frog;outer;nice;regular;year;clothing;check;throughout;farmer;dug;dark;exercise;table;your;form;should;personal;use;road;bright;walk;fairly;affect;but;night;close;job;front;fight;beside;ocean;herd;pass;hardly;widely;prepare;nails;paid;lucky;design;grandfather;aid;heavy;truck;sleep;difficult;log;keep;government;headed;mother;sad;bread;voyage;when;happy;making;whistle;plural;guard;therefore;continent;roof;money;pan;unusual;region;special;generally;plate;visit;look;lost;sick;wonderful;farther;put;characteristic;gravity;trap;system;twice;taste;knew;mad;smallest;automobile;return;huge;underline;danger;news;electric;information;breeze;thread;equally;five;new;average;former;wild;spend;cabin;recognize;nearest;circle;such;found;pass;whistle;slave;event;knowledge;fear;friend;am;browserling;cry;length;thy;create;busy;office;earth;blind;smallest;birthday;putting;classroom;pen;southern;summer;put;open;solution;spread;equator;else;kitchen;determine;strong;change;world;pocket;claws;earn;excellent;drove;donkey;rush;band;energy;fighting;hurt;ordinary;native;visitor;give;storm;pressure;imagine;street;engine;worth;hospital;attached;subject;perhaps;hospital;living;waste;dark;natural;change;enter;girl;motor;element;experiment;physical;value;excited;fort;layers;buy;minerals;satisfied;next;spirit;unhappy;storm;angry;science;desk;develop;behind;afraid;act;else;prepare;given;raw;affect;husband;ring;older;brought;book;cow;lake;sides;ago;fill;successful;real;aside;taught;mind;straight;date;very;chart;slabs;thin;saddle;full;sort;heard;surprise;fox;cool;dish;alphabet;early;spring;nest;sometime;date;light;break;lion;difference;rhyme;might;step;teach;potatoes;young;nine;liquid;how;lunch;heavy;mass;being;save;cutting;negative;swimming;cutting;journey;army;none;worry;leave;explore;baseball;fight;road;exact;hay;voyage;sheet;test;right;examine;agree;heart;pig;cannot;tool;hill;changing;bee;find;together;lay;tie;lost;continued;then;came;rhyme;mirror;town;substance;both;up;quite;push;shake;solid;result;you;ought;chicken;waste;freedom;why;somehow;not;complete;sick;struggle;military;pure;top;south;step;education;could;between;familiar;recognize;rich;tool;material;were;chicken;stopped;stay;policeman;round;firm";
+
+
- /*database *db = newDatabase("miDB");
++ database *db = newDatabase("miDB");
+
+ addFileTag(db, "vaca.png", "naturaleza");
+ addFileTags(db, "donald-tromp.jpg", 3, "based", "hitler", "very cool");
+
+ storeDatabase(db, "db.db");
- */
- database *db = loadDatabase("db.db");
++
++ db = loadDatabase("db.db");
+
+ printDatabase(db);
+
+ debugDatabase(db);
- row *r = newRow("~/test/img.png");
+
while(0){
prompt();