Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 18059 invoked from network); 20 Dec 2009 21:22:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Dec 2009 21:22:44 -0000 Received: (qmail 43882 invoked by uid 500); 20 Dec 2009 21:22:43 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 43797 invoked by uid 500); 20 Dec 2009 21:22:42 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 43787 invoked by uid 99); 20 Dec 2009 21:22:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Dec 2009 21:22:42 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of 7zark7@gmail.com designates 209.85.211.172 as permitted sender) Received: from [209.85.211.172] (HELO mail-yw0-f172.google.com) (209.85.211.172) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Dec 2009 21:22:35 +0000 Received: by ywh2 with SMTP id 2so4888773ywh.27 for ; Sun, 20 Dec 2009 13:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=6IDmqRaJ3ZANdApvIZOwkAfP0hDgqHwBcAIIsQDGlQY=; b=W9tORXSyeNiQHhQYVi6wMxDPavxWINa2eDxQhqR/kBMuL2Pp08AGnTYJHP5M3nxVRn bJm/hHhDqpgilhCWCCVhHS++7nmbjBXduzyUPV7ObxxIAMZXa+l0MFuE/eyRF7gqjZJY 53UbC8W8V2d8tcGE5bT7soS6Fj07mVgiGQuKo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=v7THabDG4kixv4IlyuuLFJG7FgqIWTmvruVstuwGFcipeHiKc/6dfP5CcEhL1vgEBb HcqBiArWEiL1Rldf3M7XuQCEWtQsO4BDRx4yuF1usxkqRBJ4XGGQPk2cnT8f2Wy0pzAg 32ZahNca1wUZVT+aEJ6bmtKCzAanQtv63I6Rk= Received: by 10.150.110.23 with SMTP id i23mr9688751ybc.345.1261344134221; Sun, 20 Dec 2009 13:22:14 -0800 (PST) Received: from NONA.local (pool-71-102-212-43.snloca.dsl-w.verizon.net [71.102.212.43]) by mx.google.com with ESMTPS id 7sm1797466ywf.10.2009.12.20.13.22.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 20 Dec 2009 13:22:13 -0800 (PST) Message-ID: <4B2E9583.3060601@gmail.com> Date: Sun, 20 Dec 2009 13:22:11 -0800 From: 7zark7 <7zark7@gmail.com> User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Observation on REST lib performance Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Not specifically about CouchDB, but have been experimenting with REST-based Java/Groovy DAOs using CouchDB as the backend. Thought folks here might be interested in the info. I created some REST DAOs using Groovy's HttpBuilder, and Spring's RestTemplate. Both use Google's GSON library for serializing to JSON. Examples of create method: Spring's RestTemplate implementation: public String create(Pojo pojo) { Map response = restTemplate.postForObject(url, pojo, Map.class); String id = (String)response.get("id"); String rev = (String)response.get("rev"); pojo.setKey(id); pojo.setRevision(rev); return pojo.getKey(); } Groovy's HttpBuilder implementation: String create(Pojo pojo) { httpBuilder.request(POST, JSON) { send JSON, toJson(pojo) response.success = {resp, json -> pojo.key = json.id as String pojo.revision = json.rev as String } } pojo.key } I found that the Spring implementation is nearly 50 times faster than the Groovy implementation. Of course, the Groovy implementation was much easier to implement the Couch API with and was great for prototyping. I can make a blog post somewhere if folks are interested in further code details. Best, Z