Debian Bug report logs - #312379
Important performance patch that speeds things up over 10x for CJK fonts

version graph

Package: fonttools; Maintainer for fonttools is Paul Wise <pabs@debian.org>; Source for fonttools is src:fonttools.

Reported by: Tomasz Wegrzanowski <taw@users.sf.net>

Date: Tue, 7 Jun 2005 20:03:02 UTC

Severity: normal

Tags: patch

Fixed in version 1.99+2.0b1+cvs20031014-1

Done: Paul Wise <pabs3@bonedaddy.net>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Anthony Fok <foka@debian.org>:
Bug#312379; Package fonttools. Full text and rfc822 format available.

Acknowledgement sent to Tomasz Wegrzanowski <taw@users.sf.net>:
New Bug report received and forwarded. Copy sent to Anthony Fok <foka@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Tomasz Wegrzanowski <taw@users.sf.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Important performance patch that speeds things up over 10x for CJK fonts
Date: Tue, 07 Jun 2005 21:54:31 +0200
[Message part 1 (text/plain, inline)]
Package: fonttools
Version: 1.99+2.0b1+cvs20031014-1
Severity: normal
Tags: patch

ttx accidentally uses a O(n^2) algorithm for converting hexdump to binary:
  hexdata = ""
  for chunk in content:
    if type(chunk) == type(""):
      hexdata = hexdata + chunk

This *copies* hexdata on every line. The mistake is understandable,
as the code looks similar to perl's (and few other languages') idiom
  for $chunk(@content) { $hexdata .= $chunk if something($chunk) }
that works in place.

For Western fonts, that are usually in ~100kB size range, the O(n^2)
behaviour is not very problematic, but the CJK fonts are often 5-10MB
or larger, so it takes about forever for the hexdump to binary conversion
on ttx->ttf to finish (I don't know how long exactly, I ^C-ed the program
and started debugging after about 25 minutes on 6MB Sazanami Gothic font)

The patch replaces 2 instances of:
	data = ""
	for:
		data = data + something
	return data
with semantically equivalent, but O(n):
	data = []
	for:
		data.append(something)
	return "".join(data)

Actually I converted readHex to more pythonesque list-comprehension format
instead of appending in loop (it's equivalent to the loop, after compilation),
but this isn't very important.


In a different thread,
fonttools seems to have many other bugs that appear when I try to process CJK fonts
with it, and the last release on sf.net was in 2002. Is it abandoned ?
[performance_patch_for_cjk_fonts.diff (text/plain, attachment)]

Reply sent to Paul Wise <pabs3@bonedaddy.net>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Tomasz Wegrzanowski <taw@users.sf.net>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #10 received at 312379-done@bugs.debian.org (full text, mbox):

From: Paul Wise <pabs3@bonedaddy.net>
To: 329171-done@bugs.debian.org, 306287-done@bugs.debian.org, 312379-done@bugs.debian.org, 249673-done@bugs.debian.org, 328098-done@bugs.debian.org
Subject: fontools 1.99+2.0b1+cvs20050624-2 fixes these bugs
Date: Fri, 07 Oct 2005 12:26:21 +0800
[Message part 1 (text/plain, inline)]
Version: 1.99+2.0b1+cvs20031014-1

I've adopted this package and found a sponsor to upload the new package,
which fixes all these bugs.

-- 
bye,
pabs

http://wiki.debian.org/PaulWise
[signature.asc (application/pgp-signature, inline)]

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Tue, 26 Jun 2007 16:46:21 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Apr 18 21:14:38 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.