In previous post I've advertised my text about trie representations.
Depending on particular representation internal memory fragmentation vary from 25% to 46% (in GNU libc). In other words if trie should occupy 100MB then in the worst case real memory usage is around 200MB. I've never suppose that fragmentation could be so significant.
When quite simple memory pools were used, then internal fragmentation has been cut down to 1-2%! Impressive.
poniedziałek, 28 marca 2011
sobota, 26 marca 2011
Efficient trie representation
While implementing Aho-Corasick algorithm I've checked several trie representations.
niedziela, 27 lutego 2011
środa, 23 lutego 2011
Grafika komputerowa I
Całkiem udany skrypt do grafiki komputerowej autorstwa Przemysława Kiciaka udostępnił UW w ramach swojego portalu z materiałami dydaktycznymi. Obszerna tematyka, więc miejscami skrótowo i ogólnikowo, ale ogólnie wygląda zachęcająco.
niedziela, 10 października 2010
PIC Language
Yesterday I made my first diagram with PIC (see Wikipedia) and... I felt in love. Language is just perfect, intuitive and powerful. Try it and you will never use any popular drawing software.
wtorek, 28 września 2010
Xorg VESA driver - higher resolutions
Default configuration of VESA driver allows resolutions 640x480 and 800x600.
It is quite simple to get higher resolutions - in section Monitor of /etc/X11/xorg.conf we have to set horizontal and vertical refresh rates. By default these values are set to lowest, safe area.
Here are my settings:
X.org is able to work at 1280x1024 with vertical refresh rate 75Hz. HTH
It is quite simple to get higher resolutions - in section Monitor of /etc/X11/xorg.conf we have to set horizontal and vertical refresh rates. By default these values are set to lowest, safe area.
Here are my settings:
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
HorizSync 42.0 - 80.0
VertRefresh 55.0 - 100.0
EndSectionX.org is able to work at 1280x1024 with vertical refresh rate 75Hz. HTH
wtorek, 24 sierpnia 2010
PostgrSQL: printf in PL/pgSQL
PostgreSQL wiki has entry about sprintf - is is quite simple approach (and isn't marked as immutable), the main drawback is iterating over all chars of format string. Here is a version use strpos to locate % in format string, and it's faster around 2 times:
CREATE OR REPLACE FUNCTION printf2(fmt text, variadic args anyarray) RETURNS text
LANGUAGE plpgsql IMMUTABLE AS $$
DECLARE
argcnt int := 1;
head text := ''; -- result
tail text := fmt; -- unprocessed part
k int;
BEGIN
LOOP
k := strpos(tail, '%');
IF k = 0 THEN
-- no more '%'
head := head || tail;
EXIT;
ELSE
IF substring(tail, k+1, 1) = '%' THEN
-- escape sequence '%%'
head := head || substring(tail, 1, k);
tail := substring(tail, k+2);
ELSE
-- insert argument
head := head || substring(tail, 1, k-1) || COALESCE(args[argcnt]::text, '');
tail := substring(tail, k+1);
argcnt := argcnt + 1;
END IF;
END IF;
END LOOP;
RETURN head;
END;
$$;
Subskrybuj:
Posty (Atom)