Re: easy way of copying regex_t

Поиск
Список
Период
Сортировка
От Artur Zakirov
Тема Re: easy way of copying regex_t
Дата
Msg-id 56A53DAA.7030406@postgrespro.ru
обсуждение исходный текст
Ответы Re: easy way of copying regex_t  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> Hi all,
>
> I've been working on moving an extension that allows to move the ispell
> dictionaries to shared segment. It's almost complete, the last FIXME is
> about copying regex_t structure (stored in AFFIX).
>
> According to regex.h the structure is fairly complex and not exactly easy
> to understand, so I'd like to know if anyone here already implemented that
> or something that may serve the same purpose. Any ideas?
>
> kind regards
> Tomas

This message is the reply to the message
http://www.postgresql.org/message-id/dd02a31fdeffbf5cb24771e34213b40f.squirrel@sq.gransy.com
Sorry, I can't reply to it directly. I can't get it from archive.

Thank you for your extension shared_ispell. It is very useful. I have
got it from https://github.com/tvondra/shared_ispell
With this message I want to send some patch to your repository with
draft of a code, which allows shared_ispell to copy regex_t.

The main idea of the patch is:
- we doesn't need copy all regex_t structure
- most of fields and structures used only in a compile time
- we need copy structures: guts, colormap, subre, cnfa
- from the subre structure we need only cnfa

colormap represents a directed acyclic graph. cnfa represents a
nondeterministic finite automaton.

In this patch also was done the following:
- added regression tests
- deleted spell.h and spell.c since they have duplicate code
- added shared_ispell.h which declares some structures
- fix an issue when stopFile can be NULL
- fixed countCMPDAffixes since theoretically could be zero affix
- added copyCMPDAffix

Question to hackers. Can such patch be useful as a PostgreSQL patch to
Full-Text search? Is it needed?

shared_ispell loads dictionaries into a shared memory. The main benefits
are:
- saving of memory. Every dictionary is loaded only once. Dictionaries
are not loaded for each backend. In current version of PostgreSQL
dictionaires are loaded for each backend where it was requested.
- saving of time. The first load of a dictionary takes much time. With
this patch dictionaries will be loaded only once.

--
Artur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Removing Functionally Dependent GROUP BY Columns
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Removing Functionally Dependent GROUP BY Columns