From da581d15930088caf46f5c5411df8dedfee3f3c3 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sun, 29 May 2022 16:42:47 +0200 Subject: [PATCH] Idr --- TODO | 20 ++++++++++++++++++++ src/main.c | 14 +++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index d133a03..278f9ad 100644 --- a/TODO +++ b/TODO @@ -1 +1,21 @@ 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); + diff --git a/src/main.c b/src/main.c index 9ca0eb2..613fec7 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,5 @@ #include "db.h" +#include int main(){ @@ -7,17 +8,6 @@ int main(){ row *r = newRow("~/test/img.png"); - 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"; - int l = len(str); - printf("len: %d\n", l); - - - //measure these two - int a = strInTags(str, l, "percent", 7, ';'); - //int a = BM("percent", 7, str, l); - - - while(0){ prompt(); @@ -36,4 +26,6 @@ int main(){ break; }*/ } + + return 0; } -- 2.39.5