• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

dorian_borin
#1 Posted : Sunday, February 17, 2008 8:59:30 PM(UTC)
dorian_borin

Rank: Member

Joined: 8/3/2007(UTC)
Posts: 22

I've spent a considerable amount of time trying to precompile BVC5 SP3. The main motivation was for performance. By default every page is compiled separately into a DLL and there is a hit on the first access of every page. In doing the precompile it is possible to merge the classes into one DLL just like how visual studio 2003 did it. I found a number of BVC5 classes which had the same exact name in them. This prevented me from using the VS2005 Web Deployment Project to precompile/deploy. VS2005 was a real pain and didn’t show why it failed. I had to run the aspnet_merge command from the command line to see an error. It would only show one error so I had to a full compile/build cycle for each of the classes below. It took nearly an hour. I figured I'd post them here to that BV could make the changes in case anyone wants to use web projects or do precompiling.

So far I've spent a little over a day trying to precompile BVC5 SP3. I've had no joy yet. For some reason it actually behaves differently after you run the aspnet_compile command. Some controls don't render, most noticeably the home page columns are simply missing. I've got absolutely no idea why. I've searched the web heaps without any luck. I'm giving up. If anyone has tried precompiling and succeeded I'd love to know.

BTW the list of files/classes which have duplicated class names are:
BVAdmin\Plugins\BVFroogleFeed\Default
BVAdmin\Content\CategoryTemplates
BVAdmin\Content\CategoryTemplatesEdit
BVAdmin\Reports\SalesByDate\Default
BVModules\Themes\Bvc5\Service
BVModules\ProductInputs\TextInput\View
BVModules\ProductInputs\TextInput\AdminView
BVModules\ProductInputs\HtmlArea\View
BVModules\ProductInputs\HtmlArea\Edit
BVModules\ProductChoices\ImageRadioButton\View
BVModules\ProductChoices\ImageRadionButtonList\Edit
BVModules\ProductChoices\RadioButtonList\View
BVModules\ProductChoices\RadioButtonList\Edit
BVModules\ProductChoices\RadioButtonList\AdminView
BVModules\CreditCardGateways\PaypalWebsitePaymentsPro\Edit
BVModules\Checkouts\BVC2004\Checkout\CVV
BVModules\Checkouts\OnePage\Checkout\CVV
BVModules\Themes\PrintBook\MyAccount
BVModules\ProductModifiers\RadioButtonList\AdminView
BVModules\OrderTasks\DebitGiftCertificates\Edit
BVModules\ContentBlocks\OrderActivity\AdminView
AdditionalProductAccessories
AffiliateTerms
ShippingTerms
TermsPopUp
jetheredge
#2 Posted : Tuesday, February 19, 2008 8:48:36 AM(UTC)
jetheredge

Rank: Member

Joined: 3/1/2006(UTC)
Posts: 1,142

There is a lot of problems with precompilation because we dynamically load a lot of user controls. Once you precompile them you remove all the contents of the files and then you don't have anything to dynamically load.
Justin Etheredge
Senior Software Engineer
BVSoftware
CorneliuTusnea
#3 Posted : Tuesday, February 19, 2008 4:45:02 PM(UTC)
CorneliuTusnea

Rank: Member

Joined: 8/17/2006(UTC)
Posts: 681

Justin,
Precompiling will keep the aspx/ascx file but compile all the code behind in a dll, so dynamically loading controls will still work.
Regards,
Corneliu.
http://www.bestgames.com.au
http://www.bestchess.com.au



BV Product Links, Details and Signatures: Improve your customer experience:

http://www.acorns.com.au/projects/bv/quicklink/

dorian_borin
#4 Posted : Wednesday, February 20, 2008 11:44:47 PM(UTC)
dorian_borin

Rank: Member

Joined: 8/3/2007(UTC)
Posts: 22

I think Microsoft are screwing something up. It makes no sense that it should behave differently because it was compiled by a different tool.
jetheredge
#5 Posted : Thursday, February 21, 2008 8:19:34 AM(UTC)
jetheredge

Rank: Member

Joined: 3/1/2006(UTC)
Posts: 1,142

Corneliu, unless something has changed, that is not the case. Unless you pass the "-u" command to the aspnet precompiler they will not be updateable and the aspx/ascx files will just be marker files that say "This is a marker file generated by the precompilation tool, and should not be deleted!". Even though the actual filename is there, dynamic user control loading will not work with these files. I honestly don't think we have tried the dynamic user control loading with the updateable option, but my bet would be that this won't work either.
Justin Etheredge
Senior Software Engineer
BVSoftware
jetheredge
#6 Posted : Thursday, February 21, 2008 8:29:20 AM(UTC)
jetheredge

Rank: Member

Joined: 3/1/2006(UTC)
Posts: 1,142

I actually just looked it up, and apparently, if you do use the updateable option, then the user controls should still be able to load. We will take a look at the list of repeated class names and try to get them fixed.
Justin Etheredge
Senior Software Engineer
BVSoftware
CorneliuTusnea
#7 Posted : Thursday, February 21, 2008 9:03:55 AM(UTC)
CorneliuTusnea

Rank: Member

Joined: 8/17/2006(UTC)
Posts: 681

:)
http://www.bestgames.com.au
http://www.bestchess.com.au



BV Product Links, Details and Signatures: Improve your customer experience:

http://www.acorns.com.au/projects/bv/quicklink/

jetheredge
#8 Posted : Thursday, February 21, 2008 1:38:53 PM(UTC)
jetheredge

Rank: Member

Joined: 3/1/2006(UTC)
Posts: 1,142

My concern is that you have to still use the updateable option, which most people have no idea about, and which some would argue voids the point of precompilation since as soon as you make a change you are now back to dynamic compilation. Not to mention the fact that the dynamically loading user controls are still dynamically compiled.
Justin Etheredge
Senior Software Engineer
BVSoftware
CorneliuTusnea
#9 Posted : Thursday, February 21, 2008 5:47:54 PM(UTC)
CorneliuTusnea

Rank: Member

Joined: 8/17/2006(UTC)
Posts: 681

Justin,
Once you get the names fixed, you will be able to convert the website to a webapp to get proper assembly compilation, better performance AND dynamic controls.
Regards,
Corneliu.
http://www.bestgames.com.au
http://www.bestchess.com.au



BV Product Links, Details and Signatures: Improve your customer experience:

http://www.acorns.com.au/projects/bv/quicklink/

jetheredge
#10 Posted : Friday, February 22, 2008 1:55:01 PM(UTC)
jetheredge

Rank: Member

Joined: 3/1/2006(UTC)
Posts: 1,142

Yes, but we won't be moving over to a web project with this version of BV. BV6 will likely be a web project.
Justin Etheredge
Senior Software Engineer
BVSoftware
CorneliuTusnea
#11 Posted : Saturday, February 23, 2008 4:15:30 AM(UTC)
CorneliuTusnea

Rank: Member

Joined: 8/17/2006(UTC)
Posts: 681

Why not?
If the class named are fixed there is nothing to stop you moving to a webproject. The support is so much better in VS and performance wise it they are better as well.
Some say MS shouldn't have bothered to do the website stuff in VS and just do the webproject :)
Regards,
Corneliu.
http://www.bestgames.com.au
http://www.bestchess.com.au



BV Product Links, Details and Signatures: Improve your customer experience:

http://www.acorns.com.au/projects/bv/quicklink/

dorian_borin
#12 Posted : Sunday, February 24, 2008 8:01:50 PM(UTC)
dorian_borin

Rank: Member

Joined: 8/3/2007(UTC)
Posts: 22

I've spent another day on this and I've got to the bottom of it.

The aspnet_compiler tool will not leave .ascx and .master files in place even as markers unless you use the -u option. A few classes in BV5 need to find those files physically present in order to operate properly. The primary reasons are safe loading of master pages if the the template doesn't provide on and control loading in ModuleController. I'll mention more about this later in this post.

BV5 will not build with aspnet_compiler -u however because the user control references are referencing the sub classes instead of the actual classes that BV wrote. Basically it shouldn't be referencing ASP.something_ascv but rather Something. Here are two examples, one for a user control and one for a master page.

User Control Reference

Bad:

Dim singleProductDisplay As ASP.bvmodules_controls_singleproductdisplay_ascx = DirectCast(row.FindControl("SingleProductDisplay"), ASP.bvmodules_controls_singleproductdisplay_ascx)

Good:

Dim singleProductDisplay As [red]BVModules_Controls_SingleProductDisplay[/red] = DirectCast(row.FindControl("SingleProductDisplay"), [red]BVModules_Controls_SingleProductDisplay[/red])

Master Page Reference

Bad:

If TypeOf Me.Master Is ASP.bvadmin_bvadminproduct_master Then
DirectCast(Me.Master, ASP.bvadmin_bvadminproduct_master).ShowProductDisplayPanel = False

Good:

If TypeOf Me.Master Is [red]BVAdmin_BVAdminProduct[/red] Then
DirectCast(Me.Master, [red]BVAdmin_BVAdminProduct[/red]).ShowProductDisplayPanel = False

These are the only types of references I've found in BV. I've fixed all of them up (there were only about 10). They were easy to find. I just searched for _ascx and _master. Now I've got it precompiling and working.

In trying to avoid using the -u so everyone could be precompiled I've tried a few things. First I thought perhaps BV could just attempt to load the controls and get a null return but ASP.Net doesn't support that. It will throw an exception which is rather too ugly for my liking. I disassembler the ASP.Net framework and started digging. I thought there must be somewhere that knows which .ascx files were there at build and all I had to do was find out how to get at it. After hours and hours of digging I found the VirtualPathProvider stuff. That didn't work however because the runtime virtual path provider which only looks at physical files. The BuildManager has access to a special virtual path provider that understands the pre-build files. It is totally hidden away. So there is know way that I can see you can determine if a particular .ascx file was present at build. This means either we keep using File.Exists and keep using the -u option of aspnet_compile or we live with an exception being thrown each time and caught. I'm not sure of the performance impact of that so it would probably need to be cached.

As for aspnet_merge. That would only be achievable after the class names become unique. I'm not too worried about that. At least most of the web site is precompiled.
Andy Miller
#13 Posted : Sunday, February 24, 2008 9:40:09 PM(UTC)
Andy Miller

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 2,136

Was thanked: 1 time(s) in 1 post(s)
Are there any studies on the amount of time spent parsing/compiling to IL versus JITting to native code versus transmitting the HTML to the client? I can see that pre-parsing the files can save some time...and that the total amount of time is probably significant. But I wonder if the time you save pre-parsing a single file makes a significant difference. For example if pre-parsing to IL take .01 seconds for single page, and JIT to native takes .01 seconds, and sending the HTML takes 1 second. Then does it really matter if you pre-parse? You are only saving .01 seconds on that page.

And if you pre-parse to a single IL assembly, then the first request will cause a significant JIT to native delay. Wouldn't it be better to spread the JIT to native around so that any single page only sees a tiny hit?
Andy Miller
Structured Solutions

Shipper 3 - High Velocity Shipment Processing
dorian_borin
#14 Posted : Monday, February 25, 2008 4:15:53 PM(UTC)
dorian_borin

Rank: Member

Joined: 8/3/2007(UTC)
Posts: 22

This is what I understand. There are 4 levels you could deploy with.

Level 1 - No precompilation of anyway

When you first hit the site it will compile the App Code, the page, master page, and every control it needs. The templated controls take a bit longer as it will spit the out them into many segment. A complex page could result in 50 .vb files and are compiled into a separate DLL. As new hits are encountered it will continue compiling anything it has not compiled already.

Level 2 - Precompilation with updatability

This is a little better than level one as all of the App Code is precompiled but all the aspx, ascx and master pages remain under compiled until first used. So there is still a fair bit of compilation that occurs on the fly.

Level 3 - Precompilation without updatability

This will precompile the App Code just like level 2 but will also precompile the template controls such as aspx, ascx and master pages. It will do the work of splitting out each into a bunch of .vb files and then prebuilds each into its own DLL. There are lots of DLLs. The DLLs are loaded on demand by the IIS worker process. The loading of a DLL is pretty quick so this level of precompilation will give snappy response times to users for the first request of any page.

Level 4 - Precompilation without updatability in a single DLL

This level does everything from level 3 but it merges all the little DLLs for each template control and the App Code into one big DLL.

My personal opinion is that level 3 or 4 is the right amount of precompilation for an important site. With the changes I've mentioned we can get BV from level 1 to level 2.
jetheredge
#15 Posted : Tuesday, February 26, 2008 9:09:50 AM(UTC)
jetheredge

Rank: Member

Joined: 3/1/2006(UTC)
Posts: 1,142

We aren't switching BVC5 over to be a web project because we don't like changing horses midstream. Making changes like that in the middle of a release *always* has unintended side effects. Especially when we are dealing with hundreds of different environments. We will evaluate switching for the next version. I agree with Andy about spreading out the JIT versus pre-compilation isn't a big deal for most people, but honestly we want to switch for the convenience of the web project, not really the one-time speedup involved with pre-compilation.
Justin Etheredge
Senior Software Engineer
BVSoftware
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012