On Thu, 2009-06-18 at 14:30 +0200, Giacomo Tesio wrote:

> I just like to have some profiling done with an external mapping...

I keep telling you that we need an e.g. DbLinq.Sqlite_test_xml.dll
project which uses XML mapping files instead of Reflection.  This would
really only require moving TestBase.CreateDB(ConnectionState) from
src/DbLinq/Test/Providers/TestBase.cs into the per-DB TestBase.cs files
(e.g. src/DbLinq.Sqlite/Test/TestBase.cs), and provide a new TestBase.cs
partial implementation for DbLinq.Sqlite_test_xml.dll which would
explicitly provide an XmlMappingSource to the Northwind constructor.

So with minimal changes we could get all tests running against the
XmlMappingSource implementation, allow us to get timing information, and
help ensure that XmlMappingSource actually works.

If no one else does this, I'll try to get this working next week.

> Could XmlMappingSource become in some way lazy?

Probably.  I won't be able to look into doing this soon, though.

> I wonder if it would be needed, since the mapping could be fully
> loaded and reused (it has no public constructor, I think to suggest
> such usage way).

The less I/O done, the better.  Granted, you'll still need to read the
whole file, but there is a world of difference between reading an XML
file into memory, vs. reading the XML file into memory and fully
initializing the Meta* members.  I think making it lazy could be a win.

> A question: doing the same query twice on the same DataContext, would
> gain the same time for step 2?

The second query would run faster.  AttributedMetaModel caches the
results of Type lookup, so when you request an already looked-up type
it'll find it immediately.

Granted, the net win won't be that major, since now all initialization
is lazy, so the first lookup won't take very long to begin with.  It'll
still be faster, though.

(Note: while I may often say that "caches are evil," in this case the
cache is tied to a DataContext instance, and thus will be cleaned up
when the DataContext is.  It's not a global cache, because global caches
are evil.)

 - Jon


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to