Re: [ft] Minimizing small file reads

2008-11-18 Thread suzuki toshiya

Hi,

As Mickey Gabel has proposed, it is possible to load a font face from
a memory image that is copied from a font file.

Please check FT_Open_Face() API
http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Open_Face
and its argument
http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Open_Args
It is possible to make a FT_Face object from a memory image.

If you want a concrete example, please check an implementation of
a private internal function open_face_from_buffer() in src/base/ftobjs.c.

Regards,
mpsuzuki


☂Josh Chia (谢任中) wrote:

Hi

If you're talking about mmap(), yes my system has mmap, but I'll have to
check whether I have it enabled in my freetype build.  I notice that
freetype is reading little pieces of data, like a long here and there.  I
also see larger chunks of 4k being read, but ideally, I would like to have
everything in memory so that I don't need any calls to read() after some
initial read(s).  Perhaps, there's a way to prefetch entire font files?

If mmap() can be used to avoid small reads, I should probably investigate
how to make use of it.

Josh

On Mon, Nov 17, 2008 at 9:34 PM, suzuki toshiya
[EMAIL PROTECTED]wrote:

  

Hi,

In the system supporting memmap() and FreeType2 is configured
to use it, the number of system call would be much reduced in
comparison with the system without memmap. In the target platform
which you're working for, memmap() is available? Or, available
and configured to use it, but you think still too many read
system call is executed?

Regards,
mpsuzuki

☂Josh Chia (谢任中) wrote (2008/11/18 10:39):



Hi,

I notice that freetype makes a lot of small reads, resulting in a lot of
SYS_read calls.  I'm using freetype in an app that runs in a ptrace
sandbox,
so performance is sensitive to system calls.  Is there a simple way to
prevent the numerous small reads (via ft_ansi_stream_io), such as
configuring freetype to prefetch into a large buffer when reading, and
making it assume that font files never change?  Will I need to make some
configuration changes or do I need to make code changes?  Thanks!

Josh





___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype

  





___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype


Re: [ft] Minimizing small file reads

2008-11-18 Thread Mickey Gabel
What about loading the font completely into memory and having FT2 work 
on the loaded buffer?



suzuki toshiya wrote:

Hi,

In the system supporting memmap() and FreeType2 is configured
to use it, the number of system call would be much reduced in
comparison with the system without memmap. In the target platform
which you're working for, memmap() is available? Or, available
and configured to use it, but you think still too many read
system call is executed?

Regards,
mpsuzuki

☂Josh Chia (谢任中) wrote (2008/11/18 10:39):

Hi,

I notice that freetype makes a lot of small reads, resulting in a lot of
SYS_read calls.  I'm using freetype in an app that runs in a ptrace 
sandbox,

so performance is sensitive to system calls.  Is there a simple way to
prevent the numerous small reads (via ft_ansi_stream_io), such as
configuring freetype to prefetch into a large buffer when reading, and
making it assume that font files never change?  Will I need to make some
configuration changes or do I need to make code changes?  Thanks!

Josh





___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype




___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype





___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype


Re: [ft] Minimizing small file reads

2008-11-17 Thread suzuki toshiya

Hi,

In the system supporting memmap() and FreeType2 is configured
to use it, the number of system call would be much reduced in
comparison with the system without memmap. In the target platform
which you're working for, memmap() is available? Or, available
and configured to use it, but you think still too many read
system call is executed?

Regards,
mpsuzuki

☂Josh Chia (谢任中) wrote (2008/11/18 10:39):

Hi,

I notice that freetype makes a lot of small reads, resulting in a lot of
SYS_read calls.  I'm using freetype in an app that runs in a ptrace sandbox,
so performance is sensitive to system calls.  Is there a simple way to
prevent the numerous small reads (via ft_ansi_stream_io), such as
configuring freetype to prefetch into a large buffer when reading, and
making it assume that font files never change?  Will I need to make some
configuration changes or do I need to make code changes?  Thanks!

Josh





___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype




___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype