相同的代码,不同的运行时间

时间:2013-04-12 13:19:42

标签: .net vb.net wcf web-services

我有两个应用程序,一个通用方法和相同的代码,第一个应用程序是一个32位编译的网站,第二个是64位编译的wcf服务。

这两台机器都是64位: 拉姆6 gb 处理器Intel(R)Xeon(R)CPU E5645 @ 2.40 GHZ

问题是在WCF服务中运行时,同一段代码需要更多时间:

    Private Shared Sub AddImageToOutputPDF(ByRef pdfDoc As PdfSharp.Pdf.PdfDocument, ByVal freeImg As FreeImgDLL.freeImage)
    Dim page As PdfSharp.Pdf.PdfPage = pdfDoc.AddPage
    Dim gfx As PdfSharp.Drawing.XGraphics = PdfSharp.Drawing.XGraphics.FromPdfPage(page)
    Dim ts As New TimeSpan
    Dim st As New DateTime
    Dim en As New DateTime

    st = DateTime.Now
    If freeImg.verticleDPI = 0 Then
        freeImg.EstimateAndSetResolution()
    End If


    Dim tiffImage As PdfSharp.Drawing.XImage = PdfSharp.Drawing.XImage.FromFreeImage(freeImg)

    page.Width = New PdfSharp.Drawing.XUnit((tiffImage.Width / tiffImage.HorizontalResolution) * 72)
    page.Height = New PdfSharp.Drawing.XUnit((tiffImage.Height / tiffImage.VerticalResolution) * 72)


    gfx.DrawImage(tiffImage, 0, 0, page.Width, page.Height)

    en = DateTime.Now

    ts = en - st

    _log.Debug("Page Operation--- Add Page To Pdf using PdfSharp. ------------------Time in seconds: " + ts.TotalSeconds.ToString)

End Sub

有什么想法吗?

0 个答案:

没有答案