Wednesday, April 22, 2009

.Net framework for Linux

Mono.

I'm not sure whether this project is really useful or not.
I don't think there are many programmers who use .Net framework in linux.

But, .Net framework is very powerful, reliable and soft.
This project is a challenge. 
There are brave programmers who like a challenge.
They will prove it is useful or not. :)

NedMalloc & Hoard

NedMalloc.
http://nedprod.com/programs/portable/nedmalloc/index.html
http://sourceforge.net/projects/nedmalloc

Hoard.
http://www.hoard.org/


NedMalloc is an upgrade version of DLMalloc.
It has thread pools and memory caches in each thread.
It patches DLMalloc's weakness point in multi threads environment.

Hoard is one of the fastest memory allocators.
I heard it is used in lots of softwares.

NedMalloc is free. Its license is following a BSD and Boost license.
Hoard is not free if you use it for commercial software.


However, a decision depends on your choice. :)

Monday, April 20, 2009

Me





Me in Langkawi.

QueryPerformanceTimer

Whenever I try to use a high resolution timer,
I have written source codes down everytime.

This post is to save it. Back up. :)


#include windows.h

class QueryPerformanceTimer
{
public:
QueryPerformanceTimer() : timer_frequency_(0)
{
init();
}
virtual ~QueryPerformanceTimer() {;}

void init()
{
if (QueryPerformanceFrequency(&frequency_))
{
//printf("High:%d, Quad:%d, Low:%d\n", frequency_.HighPart, frequency_.QuadPart, frequency_.LowPart);
timer_frequency_ = (double)((long double)(frequency_.HighPart >> 32) + frequency_.LowPart);
}
else
printf("QueryPerformanceFrequency returned FAIL\n");
}

void start()
{
if (timer_frequency_ == 0)
return;

QueryPerformanceCounter(&initial_);
}

void stop()
{
if (timer_frequency_ == 0)
return;

QueryPerformanceCounter(&counter_);
}

double elapsed()
{
if (timer_frequency_ == 0)
return 0;

double elapsed = (double)((long double)(counter_.QuadPart - initial_.QuadPart) / (long double)frequency_.QuadPart);
return elapsed;
}

bool is_valid()
{
return timer_frequency_ != 0;
}

double timer_frequency()
{
return timer_frequency_;
}

private:
LARGE_INTEGER initial_;
LARGE_INTEGER frequency_;
LARGE_INTEGER counter_;

double timer_frequency_;
};


This code is very weak against exceptions. But it's okay if you use it simply.
Copy & Paste!!!

Benchmark of memory allocators.

I did a benchmark test of memroy allocators.
Standard allocator, DLMalloc, LFH.
(The standard allocator is 'std::malloc' and 'std::free').

I did the test with various environment.
Fortunately, the one image can show the result. (Of course, my original document has lots of results.)


Number of threads : 4
Block size : 128
Number of allocations : 2,000,000

CPU : Intel Core2 Quad Q6700 @2.66GHz
OS : Windows Vista
RAM : 4GB

Summary : LFH is the best.

Low-fragmentation heap

Low-fragmentations heap.

Heap fragmentation is when available memory is broken into small, non-contiguous blocks. When this occurs, memory allocation can fail even though there is enough memory in the heap to satisfy the request, because no one block of memory is large enough to satisfy the allocation request.

For applications that have a low memory usage, the standard heap is adequate; allocations will not fail due to heap fragmentation. However, if the application allocates memory frequently and uses a variety of allocation sizes, memory allocation can fail due to heap fragmentation.

Windows XP and Windows Server 2003 introduce the low-fragmentation heap (LFH). This mechanism is built on top of the existing heap, but as the name implies, it reduces fragmentation of the heap. Applications that allocate large amounts of memory in various allocation sizes should use the LFH. Note that the LFH can allocate blocks up to 16 KB. For blocks greater than this, the LFH uses the standard heap.

- MSDN

------------------------------------------------------

We can use it very easily, but it's powerful.

The only remind thing is...
This feature works on Windows XP and Window 2003 server and higher.


Friday, April 17, 2009

DLMalloc


A customized memory allocator for multi platform.
(malloc / calloc / realloc / free)

I've look into it, and then I feel its a good memory allocator.
It has flexible features even keeping its good performance.
We can produce several important options.
- Memory pooling, Threshold setting, Lock mechanism for a multi threading, and more...





Wednesday, April 15, 2009

A bad DVD ROM

My DVD Rom is Matshita UJ870s.
It is on a Sony laptop.

I just tried to cook data to empty disks.
However, a burning software showed an error message a lot.
It spoiled three empty disks.

I considered for a while, and searched on web sites.
There is no information to fix that problem, unfortunately.
I had a big trouble with my dvd rom.

After several minutes, I just changed a max speed to 8x. (Its max speed is 32x basically.)
And I also checked a speed test before cooking.
Finally, I managed to do that. Oh my goodness.
Today is in 2009 year. An 8x-speed cd rom is a pretty old thing!!!!
...
...
But there is no choice. An external DVD rom drive? I think it spends money.
(Most electronic machines are very expensive in Singapore.)
I just have an option. 8x-speed cooking.
I'm very afraid what the max speed on DVD cooking is.

Sunday, April 5, 2009

Sushi

클라키에 있는 노보텔 호텔 지하에는, 메디야 라는 일본 슈퍼마켓이 있다.
일본쌀과, 일본맥주 그리고 초밥을 먹으러 종종 가곤 하는데,
한치, 오징어 회를 매우 좋아해서 거의 갈때마다 사먹고는 한다.
기본적으로는 손바닥보다 조금 더 큰 크기의 덩어리를 통째로 파는데
썰어달라고 하면 먹기 좋게 썰어주기도 한다.

그 중 장인정신이 투철한 한 스시 메이커가 보여준 스시.



먹고 가겠다고 하면 이렇게 데코레이션까지 다시 해준다.
헌데, 자세히 보면 그냥 썰어만 준게 아니라, 굉장히 잘게 칼집을 내 준 것을 확인할 수 있다.


확대한 모습.
아주 잘게 썰어주었다. 이렇게 칼집을 내주면 씹을 때 더욱 고소한 맛을 낸다.



이렇게 한 덩어리를 집어서 꼭꼭 씹으면, 고소하고도 쫄깃한 맛을 느낄 수 있다.
칼집이 제대로 잡혀있기 때문에 더더욱 맛있다.
그 스시메이커에게 감사의 박수를. 짝짝짝.

여러분들도 한치회나 오징어회를 드실 때는 꼭 칼집을 내서 드시길.
에비수 흑맥주까지 함께한다면 최고의 조합.

Yuri (Not Yuna)



출처 : 루리웹 - 취미정보게시판 - 군대갈고길동 님 글.

와....
짱이다.

지현님 뒤를 이을 차세대 주자에서 손담비양이 고군분투하던 중이였는데,
유리가 확정이네. 짱이야.

신준이, 언배, 미역, 후리자 니들맘을 이제는 이해할 수 있을 거 같네.

ps) 후리자가 윤아가 아니라고함. 난 윤아인 줄 알았쥐. 얘가 이뻐도 윤아가 최고긴 하지. 윤아 > 유리