Hello Florian,

Did you check the execution time of the "find | sort" versus the
"listfossil()"?  Looking at your script, I think you can simplify it a bit.

# Pass all Repositories and output their name and description
fossil_info()
{
  for REPO in $@
  do
    echo $(basename "$REPO")
    fossil sql --repository "$REPO" \
    "SELECT value FROM config WHERE name IN ('project-name',
'project-description') ORDER BY name DESC LIMIT 2;"
  done
}

fossil_list $(ls -Q ./*.fossil)


If using bash, every function call can spawn a sub-shell as well as "|
while read".  My knowledge on this may be outdated.  The above will only
spawn 1 sub-shell.  By using "ls", the files will be sorted by name so the
"find | sort" is not needed.  All the repositories are passed at once,
removing the need for the "| while read".  Note that this will break if the
length of all the filenames goes beyond the bash arg limit.  This limit is
between 1K and 8K characters, don't remember exactly.

Looking at Dr. Hipp's test, you might be able to embed that TCL into your
index page.  Not sure if that is possible, something else to explore.

Good luck on your project!


Zakero

On Fri, May 26, 2017 at 7:44 AM, Florian Balmer <florian.bal...@gmail.com>
wrote:

> I'm using a customized repository index page to display a link to each
> repository, along with the project name and description queried
> directly from the repository database files.
>
> For 10-20 repositories, the following (skeleton) shell script takes
> more than 1 second to finish:
>
> #!/bin/sh
> ...
> listfossil() {
>   echo "$(basename "$1")"
>   cat <<'SQL' | ./fossil sql --repository "$1"
>     SELECT value FROM config
>     WHERE name IN ('project-name', 'project-description')
>     ORDER BY name DESC LIMIT 2;
> SQL
> }
> find . -name "*.fossil" -type f -print | sort | \
>   while IFS= read -r file; do listfossil "$file"; done
>
> Is there any way to speed up this script, i.e. by loading a :memory:
> or :temp: database instead of a real repository, attaching to each of
> the repositories and reading all the desired values in one single SQL
> query?
>
> Another idea in this context might be that the built-in "repolist"
> allowed some customization, i.e. to display the project name and
> description, possibly even with a customized header/footer
> HTML/wiki/markdown file loaded from the repository directory (similar
> to the display of the README* files in the "File List" web view).
>
> --Florian
> _______________________________________________
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to